/*package HomeBoard.GUI;

import HomeBoard.Adapter.DBAdapter;
import HomeBoard.DB.GetUserFromDB;
import HomeBoard.Data.userData;
import HomeBoard.General.HomePressEvent;
import HomeBoard.General.checkNetwork;
import HomeBoard.WebService.GetAllUserFromWeb;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.View.OnFocusChangeListener;
import android.view.View.OnTouchListener;
import android.view.ViewGroup.LayoutParams;
import android.view.WindowManager;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemSelectedListener;
import android.widget.Button;

public class actHome extends Activity {
	
	public static Context mContext;
	DBAdapter mDB;
	
    *//** Called when the activity is first created. *//*
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        
        setContentView(R.layout.main);
        final Button btnMovie = (Button) findViewById(R.id.btnMovie);
        final Button btnGame = (Button) findViewById(R.id.btnGame);
        final Button btnEbook = (Button) findViewById(R.id.btnEbook);
        final Button btnHome = (Button) findViewById(R.id.btnHome);
        final Button btnMusic = (Button) findViewById(R.id.btnMusic);
        final Button btnParental = (Button) findViewById(R.id.btnParental);
 
        mContext = getApplicationContext();
        
        //=================Goi service==============
        //Start Service 
        final myService dbSer = new myService();
        mDB=new DBAdapter(actHome.this);
        dbSer.SetContext(mDB);
        startService(new Intent(actHome.this, myService.class));
        //Kiem tra tablet co dang ket noi mang ko
        boolean isOnline = false;
        checkNetwork check = new checkNetwork();
        isOnline=check.checkConn(actHome.this);
        Log.d("Network status:::::::: ", ""+isOnline);
        //Neu da co du lieu (da get du lieu) thi khong check connection de get du lieu ve nua
        //Neu khong co du lieu thi check connection de biet co ket noi internet hay khong
        if(userData.arrUname.size()==0){
        	//Neu co online thi ghi du lieu xoa du lieu username & pass, sau do lay du lieu luu vao database
        	if (isOnline){
            	//Xoa du lieu
            	userData.arrUname.clear();
            	userData.arrPass.clear();
            	Log.d("arrUname size ::: ", ""+userData.arrUname.size());
            	//Lay tat ca thong tin user tu webservice
            	GetAllUserFromWeb g = new GetAllUserFromWeb(actHome.this);
            	g.get();
            }
            else{
            	GetUserFromDB();
            }
        }
        //===========Hieu ung khi click button======================
		OnTouchListener MovieHover = new OnTouchListener() {
			
			public boolean onTouch(View v, MotionEvent event) {
				// TODO Auto-generated method stub
				if(event.getAction()==MotionEvent.ACTION_DOWN)
                    btnMovie.setBackgroundResource(R.drawable.btnmoviehov);
                if(event.getAction()==MotionEvent.ACTION_UP)
                	btnMovie.setBackgroundResource(R.drawable.btnmovie);
				return false;
			}
		};
		
		OnItemSelectedListener MovieSelected = new OnItemSelectedListener() {

			public void onItemSelected(AdapterView<?> arg0, View arg1,
					int arg2, long arg3) {
				// TODO Auto-generated method stub
                    btnMovie.setBackgroundResource(R.drawable.btnmoviehov);
			}

			public void onNothingSelected(AdapterView<?> arg0) {
				// TODO Auto-generated method stub
				btnMovie.setBackgroundResource(R.drawable.btnmovie);
			}
		};
		
		OnTouchListener GameHover = new OnTouchListener() {
			
			public boolean onTouch(View v, MotionEvent event) {
				// TODO Auto-generated method stub
				if(event.getAction()==MotionEvent.ACTION_DOWN)
                    btnGame.setBackgroundResource(R.drawable.btngamehov);
                if(event.getAction()==MotionEvent.ACTION_UP)
                	btnGame.setBackgroundResource(R.drawable.btngame);
				return false;
			}
		};
		
		OnItemSelectedListener GameSelected = new OnItemSelectedListener() {

			public void onItemSelected(AdapterView<?> arg0, View arg1,
					int arg2, long arg3) {
				// TODO Auto-generated method stub
				btnGame.setBackgroundResource(R.drawable.btngamehov);
			}

			public void onNothingSelected(AdapterView<?> arg0) {
				// TODO Auto-generated method stub
				btnGame.setBackgroundResource(R.drawable.btngame);
			}
		};
		
		
		
		OnTouchListener EbookHover = new OnTouchListener() {
			
			public boolean onTouch(View v, MotionEvent event) {
				// TODO Auto-generated method stub
				if(event.getAction()==MotionEvent.ACTION_DOWN)
                    btnEbook.setBackgroundResource(R.drawable.btnebookhov);
                if(event.getAction()==MotionEvent.ACTION_UP)
                	btnEbook.setBackgroundResource(R.drawable.btnebook);
				return false;
			}
		};
		
		OnItemSelectedListener EbookSelected = new OnItemSelectedListener() {

			public void onItemSelected(AdapterView<?> arg0, View arg1,
					int arg2, long arg3) {
				// TODO Auto-generated method stub
				btnEbook.setBackgroundResource(R.drawable.btnebookhov);
			}

			public void onNothingSelected(AdapterView<?> arg0) {
				// TODO Auto-generated method stub
				btnEbook.setBackgroundResource(R.drawable.btnebook);
			}
		};
		
		
		
		OnTouchListener MusicHover = new OnTouchListener() {
			
			public boolean onTouch(View v, MotionEvent event) {
				// TODO Auto-generated method stub
				if(event.getAction()==MotionEvent.ACTION_DOWN)
                    btnMusic.setBackgroundResource(R.drawable.btnmusichov);
                if(event.getAction()==MotionEvent.ACTION_UP)
                	btnMusic.setBackgroundResource(R.drawable.btnmusic);
				return false;
			}
		};
		
		OnItemSelectedListener musicSelected = new OnItemSelectedListener() {

			public void onItemSelected(AdapterView<?> arg0, View arg1,
					int arg2, long arg3) {
				// TODO Auto-generated method stub
				btnMusic.setBackgroundResource(R.drawable.btnmusichov);
			}

			public void onNothingSelected(AdapterView<?> arg0) {
				// TODO Auto-generated method stub
				btnMusic.setBackgroundResource(R.drawable.btnmusic);
			}
		};
		
		OnTouchListener ParentalHover = new OnTouchListener() {
			
			public boolean onTouch(View v, MotionEvent event) {
				// TODO Auto-generated method stub
				if(event.getAction()==MotionEvent.ACTION_DOWN)
					btnParental.setBackgroundResource(R.drawable.p_control_hover);
				if(event.getAction()== MotionEvent.ACTION_UP)
					btnParental.setBackgroundResource(R.drawable.p_control_normal);
				return false;
			}
		};
        //==========================================================
        
		//Hover button khi chon phim cung
		btnMovie.setOnFocusChangeListener(new OnFocusChangeListener() {
			
			public void onFocusChange(View v, boolean hasFocus) {
				// TODO Auto-generated method stub
				if(hasFocus){
					btnMovie.setBackgroundResource(R.drawable.btnmoviehov);
				}
				else{
					btnMovie.setBackgroundResource(R.drawable.btnmovie);
				}
			}
		});
		
		
		btnEbook.setOnFocusChangeListener(new OnFocusChangeListener() {
			
			public void onFocusChange(View v, boolean hasFocus) {
				// TODO Auto-generated method stub
				if(hasFocus){
					btnEbook.setBackgroundResource(R.drawable.btnebookhov);
				}
				else{
					btnEbook.setBackgroundResource(R.drawable.btnebook);
				}
			}
		});
		
		btnGame.setOnFocusChangeListener(new OnFocusChangeListener() {
			
			public void onFocusChange(View v, boolean hasFocus) {
				// TODO Auto-generated method stub
				if(hasFocus){
					btnGame.setBackgroundResource(R.drawable.btngamehov);
				}
				else{
					btnGame.setBackgroundResource(R.drawable.btngame);
				}
			}
		});
		
		
		
		
		
		
		
		//==================Goi hieu ung hover cho cac button===================
		btnMovie.setOnTouchListener(MovieHover);
		btnGame.setOnTouchListener(GameHover);
		btnEbook.setOnTouchListener(EbookHover);
		btnMusic.setOnTouchListener(MusicHover);
		btnParental.setOnTouchListener(ParentalHover);
		//======================================================================
        
        btnMovie.setOnClickListener(new OnClickListener() {
			
			public void onClick(View v) {
				// TODO Auto-generated method stub
				Intent i = new Intent(actHome.this, actFilmMain2.class);
				i.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
				startActivity(i);
			}
		});
        
        btnEbook.setOnClickListener(new OnClickListener() {
			
			public void onClick(View v) {
				// TODO Auto-generated method stub
				//============Hien thi thong bao=======================
				AlertDialog alertDialog = new AlertDialog.Builder(actHome.this).create();
				alertDialog.setTitle("Thong bao!");
				alertDialog.setMessage("Hien chuc nang nay chua duoc hoan thien. Vui long thu lai sau!");
				alertDialog.setButton("OK", new DialogInterface.OnClickListener() {
				   public void onClick(DialogInterface dialog, int which) {

				   }
				});
				alertDialog.show();
				//============================================================================
			}
		});
        
        btnGame.setOnClickListener(new OnClickListener() {
			
			public void onClick(View v) {
				// TODO Auto-generated method stub
				//============Hien thi thong bao=======================
				AlertDialog alertDialog = new AlertDialog.Builder(actHome.this).create();
				alertDialog.setTitle("Thong bao!");
				alertDialog.setMessage("Hien chuc nang nay chua duoc hoan thien. Vui long thu lai sau!");
				alertDialog.setButton("OK", new DialogInterface.OnClickListener() {
				   public void onClick(DialogInterface dialog, int which) {

				   }
				});
				alertDialog.show();
				//============================================================================
			}
		});
        
        btnMusic.setOnClickListener(new OnClickListener() {
			
			public void onClick(View v) {
				// TODO Auto-generated method stub
				Intent i = new Intent(actHome.this, actMusic.class);
				
				i.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
				startActivity(i);
			}
		});
        
        btnParental.setOnClickListener(new OnClickListener() {
    		
    	
    		public void onClick(View v) {
    			// TODO Auto-generated method stub
    			Intent i = new Intent(actHome.this, actParentalControl.class);
    			i.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
    			startActivity(i);
    			AlertDialog alertDialog = new AlertDialog.Builder(actHome.this).create();
				alertDialog.setTitle("Thong bao!");
				alertDialog.setMessage("Hien chuc nang nay chua duoc hoan thien. Vui long thu lai sau!");
				alertDialog.setButton("OK", new DialogInterface.OnClickListener() {
				   public void onClick(DialogInterface dialog, int which) {

				   }
				});
				alertDialog.show();
    		}
    		
    	});
        
        btnHome.setOnClickListener(new OnClickListener() {
			
			public void onClick(View v) {
				// TODO Auto-generated method stub
				startActivity(HomePressEvent.GetIntent(actHome.this));
			}
		}); 
        
       
    }
    
    public static void WritetoDB(){
    	//Xoa du lieu truoc
    	myService.ClearDB();
    	//Ghi thong tin len DB de su dung neu lan truy cap toi ko co network
    	myService.WriteToDB();
    	Log.d("actHome ::: ", "Clear&WriteToDB");
    }
    
    public static void GetUserFromDB(){
    	//reset 2 arraylist trong cData
        userData.arrUname.clear();
        userData.arrPass.clear();
        //Lay thong tin user len arraylist de check
        GetUserFromDB get = new GetUserFromDB();
        get.GetUserFromDB();
        Log.d("Note::::::", "Get all user");
    }  
    
}*/